import { LoginInfo } from "f2e-server3";
import { Fetch } from "./Fetch";
import type * as server_api from "../../server/apis"

export const api_common: {
    loginUser: {(): Promise<LoginInfo>};
} = {
    loginUser: () => fetch("/login/info", { cache: 'no-cache' }).then(res => res.json()),
}

export const apis: {
    black_list: typeof server_api.black_list;
    black_list_add: typeof server_api.black_list_add;
    black_list_all: typeof server_api.black_list_all;
    black_list_delete: typeof server_api.black_list_delete;
    black_list_get: typeof server_api.black_list_get;
    white_list: typeof server_api.white_list;
    white_list_add: typeof server_api.white_list_add;
    white_list_all: typeof server_api.white_list_all;
    white_list_delete: typeof server_api.white_list_delete;
    white_list_get: typeof server_api.white_list_get;
    log_list: typeof server_api.log_list;
    log_list_add: typeof server_api.log_list_add;
} = {
    black_list: (body) => Fetch('/api/black_list', body),
    black_list_add: (body) => Fetch('/api/black_list_add', body),
    black_list_all: () => Fetch('/api/black_list_all'),
    black_list_delete: (body) => Fetch('/api/black_list_delete', body),
    black_list_get: (body) => Fetch('/api/black_list_get', body),
    white_list: (body) => Fetch('/api/white_list', body),
    white_list_add: (body) => Fetch('/api/white_list_add', body),
    white_list_all: () => Fetch('/api/white_list_all'),
    white_list_delete: (body) => Fetch('/api/white_list_delete', body),
    white_list_get: (body) => Fetch('/api/white_list_get', body),
    log_list: (body) => Fetch('/api/log_list', body),
    log_list_add: (body) => Fetch('/api/log_list_add', body),
}